home *** CD-ROM | disk | FTP | other *** search
/ Apple Developer Connection Student Program / ADC Tools Sampler CD Disk 3 1999.iso / Metrowerks CodeWarrior / Java Support / Java_Source / Java2 / src / javax / swing / JWindow.java < prev    next >
Encoding:
Java Source  |  1999-05-28  |  24.2 KB  |  782 lines  |  [TEXT/CWIE]

  1. /*
  2.  * @(#)JWindow.java    1.23 98/08/28
  3.  *
  4.  * Copyright 1997, 1998 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  *
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14. package javax.swing;
  15.  
  16. import java.awt.*;
  17. import java.awt.event.*;
  18. import java.beans.PropertyChangeListener;
  19. import java.util.Locale;
  20. import java.util.Vector;
  21. import java.io.Serializable;
  22.  
  23. import javax.accessibility.*;
  24.  
  25. /** 
  26.  * A JWindow is a container that can be displayed anywhere on the
  27.  * user's desktop. It does not have the title bar, window-management buttons,
  28.  * or other trimmings associated with a JFrame, but it is still a 
  29.  * "first-class citizen" of the user's desktop, and can exist anywhere
  30.  * on it.
  31.  * <p>
  32.  * The JWindow component contains a JRootPane as it's only child.
  33.  * The contentPane() should be the parent of any children of the JWindow.
  34.  * From the older java.awt.Window object you would normally do something like this:<PRE>
  35.  *       window.add(child);
  36.  * </PRE>
  37.  * However, using JWindow you would code:<PRE>
  38.  *       window.getContentPane().add(child);
  39.  * </PRE>
  40.  * The same is true of setting LayoutManagers, removing components,
  41.  * listing children, etc. All these methods should normally be sent to
  42.  * the contentPane() instead of the JWindow itself. The contentPane() will
  43.  * always be non-null. Attempting to set it to null will cause the JWindow
  44.  * to throw an exception. The default contentPane() will have a BorderLayout
  45.  * manager set on it. 
  46.  * <p>
  47.  * Please see the JRootPane documentation for a complete description of
  48.  * the contentPane(), glassPane(), and layeredPane() components.
  49.  * <p>
  50.  * For the keyboard keys used by this component in the standard Look and
  51.  * Feel (L&F) renditions, see the
  52.  * <a href="doc-files/Key-Index.html#JWindow">JWindow</a> key assignments.
  53.  * <p>
  54.  * <strong>Warning:</strong>
  55.  * Serialized objects of this class will not be compatible with
  56.  * future Swing releases.  The current serialization support is appropriate
  57.  * for short term storage or RMI between applications running the same
  58.  * version of Swing.  A future release of Swing will provide support for
  59.  * long term persistence.
  60.  *
  61.  * @see JRootPane
  62.  *
  63.  * @beaninfo
  64.  *      attribute: isContainer true
  65.  *      attribute: containerDelegate getContentPane
  66.  *    description: A toplevel window which has no system border or controls.
  67.  *
  68.  * @version 1.23 08/28/98
  69.  * @author David Kloba
  70.  */
  71. public class JWindow extends Window implements Accessible, RootPaneContainer 
  72. {
  73.     /**
  74.      * The JRootPane instance that manages the <code>contentPane</code> 
  75.      * and optional <code>menuBar</code> for this frame, as well as the 
  76.      * <code>glassPane</code>.
  77.      *
  78.      * @see #getRootPane
  79.      * @see #setRootPane
  80.      */
  81.     protected JRootPane rootPane;
  82.  
  83.     /**
  84.      * If true then calls to <code>add</code> and <code>setLayout</code>
  85.      * cause an exception to be thrown.
  86.      *
  87.      * @see #isRootPaneCheckingEnabled
  88.      * @see #setRootPaneCheckingEnabled
  89.      */
  90.     protected boolean rootPaneCheckingEnabled = false;
  91.  
  92.  
  93.     /**
  94.      * Creates a window with no specified owner.
  95.      */
  96.     public JWindow() {
  97.         this((Frame)null);
  98.     }
  99.  
  100.     /**
  101.      * Creates a window with the specified owner frame.
  102.      *
  103.      * @param owner the frame from which the window is displayed
  104.      */
  105.     public JWindow(Frame owner) {
  106.         super(owner == null? SwingUtilities.getSharedOwnerFrame() : owner);     
  107.         windowInit();
  108.     }
  109.  
  110.     /**
  111.      * Creates a window with the specified owner window.
  112.      *
  113.      * @param owner the window from which the window is displayed
  114.      */
  115.  
  116.     public JWindow(Window owner) {
  117.         super(owner);     
  118.         windowInit();
  119.     }
  120.   
  121.  
  122.     /** Called by the constructors to init the JWindow properly. */
  123.     protected void windowInit() {
  124.         setRootPane(createRootPane());
  125.         setRootPaneCheckingEnabled(true);
  126.     }
  127.  
  128.     /** Called by the constructor methods to create the default rootPane. */
  129.     protected JRootPane createRootPane() {
  130.         return new JRootPane();
  131.     }
  132.  
  133.     /**
  134.      * Returns whether calls to <code>add</code> and 
  135.      * <code>setLayout</code> cause an exception to be thrown. 
  136.      *
  137.      * @return true if <code>add</code> and <code>setLayout</code> 
  138.      *         are checked
  139.      *
  140.      * @see #addImpl
  141.      * @see #setLayout
  142.      * @see #setRootPaneCheckingEnabled
  143.      */
  144.     protected boolean isRootPaneCheckingEnabled() {
  145.         return rootPaneCheckingEnabled;
  146.     }
  147.  
  148.  
  149.     /**
  150.      * Determines whether calls to <code>add</code> and 
  151.      * <code>setLayout</code> cause an exception to be thrown. 
  152.      * 
  153.      * @param enabled  a boolean value, true if checking is to be
  154.      *        enabled, which cause the exceptions to be thrown
  155.      *
  156.      * @see #addImpl
  157.      * @see #setLayout
  158.      * @see #isRootPaneCheckingEnabled
  159.      * @beaninfo
  160.      *      hidden: true
  161.      * description: Whether the add and setLayout methods throw exceptions when invoked.
  162.      */
  163.     protected void setRootPaneCheckingEnabled(boolean enabled) {
  164.         rootPaneCheckingEnabled = enabled;
  165.     }
  166.  
  167.  
  168.     /**
  169.      * Creates a runtime exception with a message like:
  170.      * <pre>
  171.      * "Do not use JWindow.add() use JWindow.getContentPane().add() instead"
  172.      * </pre>
  173.      *
  174.      * @param op  a String indicating the attempted operation. In the
  175.      *            example above, the operation string is "add"
  176.      */
  177.     private Error createRootPaneException(String op) {
  178.         String type = getClass().getName();
  179.         return new Error(
  180.             "Do not use " + type + "." + op + "() use " 
  181.                           + type + ".getContentPane()." + op + "() instead");
  182.     }
  183.  
  184.  
  185.     /**
  186.      * By default, children may not be added directly to a this component,
  187.      * they must be added to its contentPane instead.  For example:
  188.      * <pre>
  189.      * thisComponent.getContentPane().add(child)
  190.      * </pre>
  191.      * An attempt to add to directly to this component will cause an
  192.      * runtime exception to be thrown.  Subclasses can disable this
  193.      * behavior.
  194.      * 
  195.      * @see #setRootPaneCheckingEnabled
  196.      * @exception Error if called with rootPaneChecking true
  197.      */
  198.     protected void addImpl(Component comp, Object constraints, int index) 
  199.     {
  200.         if(isRootPaneCheckingEnabled()) {
  201.             throw createRootPaneException("add");
  202.         }
  203.         else {
  204.             super.addImpl(comp, constraints, index);
  205.         }
  206.     }
  207.  
  208.  
  209.     /**
  210.      * By default the layout of this component may not be set,
  211.      * the layout of its contentPane should be set instead.  
  212.      * For example:
  213.      * <pre>
  214.      * thisComponent.getContentPane().setLayout(new BorderLayout())
  215.      * </pre>
  216.      * An attempt to set the layout of this component will cause an
  217.      * runtime exception to be thrown.  Subclasses can disable this
  218.      * behavior.
  219.      * 
  220.      * @see #setRootPaneCheckingEnabled
  221.      * @exception Error if called with rootPaneChecking true
  222.      */
  223.     public void setLayout(LayoutManager manager) {
  224.         if(isRootPaneCheckingEnabled()) {
  225.             throw createRootPaneException("setLayout");
  226.         }
  227.         else {
  228.             super.setLayout(manager);
  229.         }
  230.     }
  231.  
  232.  
  233.     /**
  234.      * Returns the rootPane object for this window.
  235.      *
  236.      * @see #setRootPane
  237.      * @see RootPaneContainer#getRootPane
  238.      */
  239.     public JRootPane getRootPane() { 
  240.         return rootPane; 
  241.     }
  242.  
  243.  
  244.     /**
  245.      * Sets the rootPane property.  This method is called by the constructor.
  246.      *
  247.      * @param root the rootPane object for this window
  248.      * @see #getRootPane
  249.      *
  250.      * @beaninfo
  251.      *        hidden: true
  252.      *   description: the RootPane object for this window.
  253.      */
  254.     protected void setRootPane(JRootPane root) {
  255.         if(rootPane != null) {
  256.             remove(rootPane);
  257.         }
  258.         rootPane = root;
  259.         if(rootPane != null) {
  260.             boolean checkingEnabled = isRootPaneCheckingEnabled();
  261.             try {
  262.                 setRootPaneCheckingEnabled(false);
  263.                 add(rootPane, BorderLayout.CENTER);
  264.             }
  265.             finally {
  266.                 setRootPaneCheckingEnabled(checkingEnabled);
  267.             }
  268.         }
  269.     }
  270.  
  271.  
  272.     /**
  273.      * Returns the contentPane object for this window.
  274.      *
  275.      * @return the Container which is the contentPane
  276.      * @see #setContentPane
  277.      * @see RootPaneContainer#getContentPane
  278.      */
  279.     public Container getContentPane() { 
  280.         return getRootPane().getContentPane(); 
  281.     }
  282.  
  283.     /**
  284.      * Sets the contentPane property.  This method is called by the constructor.
  285.      * @param contentPane the contentPane object for this window
  286.      *
  287.      * @exception java.awt.IllegalComponentStateException (a runtime
  288.      *            exception) if the content pane parameter is null
  289.      * @see #getContentPane
  290.      * @see RootPaneContainer#setContentPane
  291.      *
  292.      * @beaninfo
  293.      *     hidden: true
  294.      *     description: The client area of the window where child 
  295.      *                  components are normally inserted.
  296.      */
  297.     public void setContentPane(Container contentPane) {
  298.         getRootPane().setContentPane(contentPane);
  299.     }
  300.  
  301.     /**
  302.      * Returns the layeredPane object for this window.
  303.      *
  304.      * @return the JLayeredPane object
  305.      * @see #setLayeredPane
  306.      * @see RootPaneContainer#getLayeredPane
  307.      */
  308.     public JLayeredPane getLayeredPane() { 
  309.         return getRootPane().getLayeredPane(); 
  310.     }
  311.  
  312.     /**
  313.      * Sets the layeredPane property.  This method is called by the constructor.
  314.      * @param layeredPane the layeredPane object for this window
  315.      *
  316.      * @exception java.awt.IllegalComponentStateException (a runtime
  317.      *            exception) if the content pane parameter is null
  318.      * @see #getLayeredPane
  319.      * @see RootPaneContainer#setLayeredPane
  320.      *
  321.      * @beaninfo
  322.      *     hidden: true
  323.      *     description: The pane which holds the various window layers.
  324.      */
  325.     public void setLayeredPane(JLayeredPane layeredPane) {
  326.         getRootPane().setLayeredPane(layeredPane);
  327.     }
  328.  
  329.     /**
  330.      * Returns the glassPane object for this window.
  331.      *
  332.      * @return the Component which is the glassPane
  333.      * @see #setGlassPane
  334.      * @see RootPaneContainer#getGlassPane
  335.      */
  336.     public Component getGlassPane() { 
  337.         return getRootPane().getGlassPane(); 
  338.     }
  339.  
  340.     /**
  341.      * Sets the glassPane property. 
  342.      * This method is called by the constructor.
  343.      * @param glassPane the glassPane object for this window
  344.      *
  345.      * @see #getGlassPane
  346.      * @see RootPaneContainer#setGlassPane
  347.      *
  348.      * @beaninfo
  349.      *     hidden: true
  350.      *     description: A transparent pane used for menu rendering.
  351.      */
  352.     public void setGlassPane(Component glassPane) {
  353.         getRootPane().setGlassPane(glassPane);
  354.     }
  355.  
  356.  
  357.     /**
  358.      * Returns a string representation of this JWindow. This method 
  359.      * is intended to be used only for debugging purposes, and the 
  360.      * content and format of the returned string may vary between      
  361.      * implementations. The returned string may be empty but may not 
  362.      * be <code>null</code>.
  363.      * <P>
  364.      * Overriding paramString() to provide information about the
  365.      * specific new aspects of the JFC components.
  366.      * 
  367.      * @return  a string representation of this JWindow.
  368.      */
  369.     protected String paramString() {
  370.         String rootPaneCheckingEnabledString = (rootPaneCheckingEnabled ?
  371.                         "true" : "false");
  372.  
  373.         return super.paramString() +
  374.     ",rootPaneCheckingEnabled=" + rootPaneCheckingEnabledString;
  375.     }
  376.  
  377.  
  378. /////////////////
  379. // Accessibility support
  380. ////////////////
  381.  
  382.     /** The accessible context property */
  383.     protected AccessibleContext accessibleContext = null;
  384.  
  385.     /**
  386.      * Get the AccessibleContext associated with this JWindow
  387.      *
  388.      * @return the AccessibleContext of this JWindow
  389.      */
  390.     public AccessibleContext getAccessibleContext() {
  391.         if (accessibleContext == null) {
  392.             accessibleContext = new AccessibleJWindow();
  393.         }
  394.         return accessibleContext;
  395.     }
  396.  
  397.     /**
  398.      * The class used to obtain the AccessibleRole for this object.
  399.      */
  400.     protected class AccessibleJWindow extends AccessibleContext
  401.         implements Serializable, AccessibleComponent {
  402.  
  403.         // AccessibleContext methods
  404.         //
  405.         /**
  406.          * Get the role of this object.
  407.          *
  408.          * @return an instance of AccessibleRole describing the role of the 
  409.          * object
  410.          * @see AccessibleRole
  411.          */
  412.         public AccessibleRole getAccessibleRole() {
  413.             return AccessibleRole.WINDOW;
  414.         }
  415.  
  416.         /**
  417.          * Get the state of this object.
  418.          *
  419.          * @return an instance of AccessibleStateSet containing the current 
  420.          * state set of the object
  421.          * @see AccessibleState
  422.          */
  423.         public AccessibleStateSet getAccessibleStateSet() {
  424.             AccessibleStateSet states = SwingUtilities.getAccessibleStateSet(JWindow.this);
  425.             if (getFocusOwner() != null) {
  426.                 states.add(AccessibleState.ACTIVE);
  427.             }
  428.             return states;
  429.         }
  430.  
  431.         /**
  432.          * Get the Accessible parent of this object.  If the parent of this
  433.          * object implements Accessible, this method should simply return
  434.          * getParent().
  435.          *
  436.          * @return the Accessible parent of this object -- can be null if this
  437.          * object does not have an Accessible parent
  438.          */
  439.         public Accessible getAccessibleParent() {
  440.         if (accessibleParent != null) {
  441.         return accessibleParent;
  442.         } else {
  443.                 Container parent = getParent();
  444.                 if (parent instanceof Accessible) {
  445.                     return (Accessible) parent;
  446.         }
  447.             }
  448.             return null;
  449.         }
  450.  
  451.         /**
  452.          * Get the index of this object in its accessible parent. 
  453.          *
  454.          * @return the index of this object in its parent; -1 if this 
  455.          * object does not have an accessible parent.
  456.          * @see #getAccessibleParent
  457.          */
  458.         public int getAccessibleIndexInParent() {
  459.             return SwingUtilities.getAccessibleIndexInParent(JWindow.this);
  460.         }
  461.  
  462.         /**
  463.          * Returns the number of accessible children in the object.  If all
  464.          * of the children of this object implement Accessible, than this
  465.          * method should return the number of children of this object.
  466.          *
  467.          * @return the number of accessible children in the object.
  468.          */
  469.         public int getAccessibleChildrenCount() {
  470.             return SwingUtilities.getAccessibleChildrenCount(JWindow.this);
  471.         }
  472.  
  473.         /**
  474.          * Return the nth Accessible child of the object.  
  475.          *
  476.          * @param i zero-based index of child
  477.          * @return the nth Accessible child of the object
  478.          */
  479.         public Accessible getAccessibleChild(int i) {
  480.             return SwingUtilities.getAccessibleChild(JWindow.this,i);
  481.         }
  482.  
  483.         /**
  484.          * Return the locale of this object.
  485.          *
  486.          * @return the locale of this object
  487.          */
  488.         public Locale getLocale() {
  489.             return JWindow.this.getLocale();
  490.         }
  491.  
  492.         /**
  493.          * Get the AccessibleComponent associated with this object if one
  494.          * exists.  Otherwise return null.
  495.          */
  496.         public AccessibleComponent getAccessibleComponent() {
  497.             return this;
  498.         }
  499.  
  500.  
  501.         // AccessibleComponent methods
  502.         //
  503.         /**
  504.          * Get the background color of this object.
  505.          *
  506.          * @return the background color, if supported, of the object; 
  507.          * otherwise, null
  508.          */
  509.         public Color getBackground() {
  510.             return JWindow.this.getBackground();
  511.         }
  512.  
  513.         /**
  514.          * Set the background color of this object.
  515.          *
  516.          * @param c the new Color for the background
  517.          */
  518.         public void setBackground(Color c) {
  519.             JWindow.this.setBackground(c);
  520.         }
  521.  
  522.         /**
  523.          * Get the foreground color of this object.
  524.          *
  525.          * @return the foreground color, if supported, of the object; 
  526.          * otherwise, null
  527.          */
  528.         public Color getForeground() {
  529.             return JWindow.this.getForeground();
  530.         }
  531.  
  532.         /**
  533.          * Set the foreground color of this object.
  534.          *
  535.          * @param c the new Color for the foreground
  536.          */
  537.         public void setForeground(Color c) {
  538.             JWindow.this.setForeground(c);
  539.         }
  540.  
  541.         /**
  542.          * Get the Cursor of this object.
  543.          *
  544.          * @return the Cursor, if supported, of the object; otherwise, null
  545.          */
  546.         public Cursor getCursor() {
  547.             return JWindow.this.getCursor();
  548.         }
  549.  
  550.         /**
  551.          * Set the Cursor of this object.
  552.          *
  553.          * @param c the new Cursor for the object
  554.          */
  555.         public void setCursor(Cursor cursor) {
  556.             JWindow.this.setCursor(cursor);
  557.         }
  558.  
  559.         /**
  560.          * Get the Font of this object.
  561.          *
  562.          * @return the Font,if supported, for the object; otherwise, null
  563.          */
  564.         public Font getFont() {
  565.             return JWindow.this.getFont();
  566.         }
  567.  
  568.         /**
  569.          * Set the Font of this object.
  570.          *
  571.          * @param f the new Font for the object
  572.          */
  573.         public void setFont(Font f) {
  574.             JWindow.this.setFont(f);
  575.         }
  576.  
  577.         /**
  578.          * Get the FontMetrics of this object.
  579.          *
  580.          * @param f the Font
  581.          * @return the FontMetrics, if supported, the object; otherwise, null
  582.          * @see getFont
  583.          */
  584.         public FontMetrics getFontMetrics(Font f) {
  585.             return JWindow.this.getFontMetrics(f);
  586.         }
  587.  
  588.         /**
  589.          * Determine if the object is enabled.
  590.          *
  591.          * @return true if object is enabled; otherwise, false
  592.          */
  593.         public boolean isEnabled() {
  594.             return JWindow.this.isEnabled();
  595.         }
  596.  
  597.         /**
  598.          * Set the enabled state of the object.
  599.          *
  600.          * @param b if true, enables this object; otherwise, disables it 
  601.          */
  602.         public void setEnabled(boolean b) {
  603.             JWindow.this.setEnabled(b);
  604.         }
  605.         
  606.         /**
  607.          * Determine if the object is visible.  Note: this means that the
  608.          * object intends to be visible; however, it may not in fact be
  609.          * showing on the screen because one of the objects that this object
  610.          * is contained by is not visible.  To determine if an object is
  611.          * showing on the screen, use isShowing().
  612.          *
  613.          * @return true if object is visible; otherwise, false
  614.          */
  615.         public boolean isVisible() {
  616.             return JWindow.this.isVisible();
  617.         }
  618.  
  619.         /**
  620.          * Set the visible state of the object.
  621.          *
  622.          * @param b if true, shows this object; otherwise, hides it 
  623.          */
  624.         public void setVisible(boolean b) {
  625.             JWindow.this.setVisible(b);
  626.         }
  627.  
  628.         /**
  629.          * Determine if the object is showing.  This is determined by checking
  630.          * the visibility of the object and ancestors of the object.  Note: 
  631.          * this will return true even if the object is obscured by another 
  632.          * (for example, it happens to be underneath a menu that was pulled 
  633.          * down).
  634.          *
  635.          * @return true if object is showing; otherwise, false
  636.          */
  637.         public boolean isShowing() {
  638.             return JWindow.this.isShowing();
  639.         }
  640.  
  641.         /** 
  642.          * Checks whether the specified point is within this object's bounds,
  643.          * where the point's x and y coordinates are defined to be relative to 
  644.          * the coordinate system of the object. 
  645.          *
  646.          * @param p the Point relative to the coordinate system of the object
  647.          * @return true if object contains Point; otherwise false
  648.          */
  649.         public boolean contains(Point p) {
  650.             return JWindow.this.contains(p);
  651.         }
  652.     
  653.         /** 
  654.          * Returns the location of the object on the screen.
  655.          *
  656.          * @return location of object on screen -- can be null if this object
  657.          * is not on the screen
  658.          */
  659.         public Point getLocationOnScreen() {
  660.             return JWindow.this.getLocationOnScreen();
  661.         }
  662.  
  663.         /** 
  664.          * Gets the location of the object relative to the parent in the form 
  665.          * of a point specifying the object's top-left corner in the screen's 
  666.          * coordinate space.
  667.          *
  668.          * @return An instance of Point representing the top-left corner of 
  669.          * the objects's bounds in the coordinate space of the screen; null if
  670.          * this object or its parent are not on the screen
  671.          */
  672.         public Point getLocation() {
  673.             return JWindow.this.getLocation();
  674.         }
  675.  
  676.         /** 
  677.          * Sets the location of the object relative to the parent.
  678.      * 
  679.      * @param p the Point object specifying the location of the
  680.      *          object's upper left corner
  681.          */
  682.         public void setLocation(Point p) {
  683.             JWindow.this.setLocation(p);
  684.         }
  685.  
  686.         /** 
  687.          * Gets the bounds of this object in the form of a Rectangle object. 
  688.          * The bounds specify this object's width, height, and location
  689.          * relative to its parent. 
  690.          *
  691.          * @return A rectangle indicating this component's bounds; null if 
  692.          * this object is not on the screen.
  693.          */
  694.         public Rectangle getBounds() {
  695.             return JWindow.this.getBounds();
  696.         }
  697.  
  698.         /** 
  699.          * Sets the bounds of this object in the form of a Rectangle object. 
  700.          * The bounds specify this object's width, height, and location
  701.          * relative to its parent.
  702.          *      
  703.          * @param A rectangle indicating this component's bounds
  704.          */
  705.         public void setBounds(Rectangle r) {
  706.             JWindow.this.setBounds(r);
  707.         }
  708.  
  709.         /** 
  710.          * Returns the size of this object in the form of a Dimension object. 
  711.          * The height field of the Dimension object contains this objects's
  712.          * height, and the width field of the Dimension object contains this 
  713.          * object's width. 
  714.          *
  715.          * @return A Dimension object that indicates the size of this 
  716.          * component; null if this object is not on the screen
  717.          */
  718.         public Dimension getSize() {
  719.             return JWindow.this.getSize();
  720.         }
  721.  
  722.         /** 
  723.          * Resizes this object so that it has width width and height. 
  724.          *      
  725.          * @param d - The dimension specifying the new size of the object. 
  726.          */
  727.         public void setSize(Dimension d) {
  728.             JWindow.this.setSize(d);
  729.         }
  730.  
  731.         /**
  732.          * Returns the Accessible child, if one exists, contained at the local
  733.          * coordinate Point.
  734.          *
  735.          * @param p The point defining the top-left corner of the Accessible, 
  736.          * given in the coordinate space of the object's parent. 
  737.          * @return the Accessible, if it exists, at the specified location; 
  738.          * else null
  739.          */
  740.         public Accessible getAccessibleAt(Point p) {
  741.             return SwingUtilities.getAccessibleAt(JWindow.this,p);
  742.         }
  743.  
  744.         /**
  745.          * Returns whether this object can accept focus or not.
  746.          *
  747.          * @return true if object can accept focus; otherwise false
  748.          */
  749.         public boolean isFocusTraversable() {
  750.             return JWindow.this.isFocusTraversable();
  751.         }
  752.  
  753.         /**
  754.          * Requests focus for this object.
  755.          */
  756.         public void requestFocus() {
  757.             JWindow.this.requestFocus();
  758.         }
  759.  
  760.         /**
  761.          * Adds the specified focus listener to receive focus events from this 
  762.          * component. 
  763.          *
  764.          * @param l the focus listener
  765.          */
  766.         public void addFocusListener(FocusListener l) {
  767.             JWindow.this.addFocusListener(l);
  768.         }
  769.  
  770.         /**
  771.          * Removes the specified focus listener so it no longer receives focus 
  772.          * events from this component.
  773.          *
  774.          * @param l the focus listener
  775.          */
  776.         public void removeFocusListener(FocusListener l) {
  777.             JWindow.this.removeFocusListener(l);
  778.         }
  779.     } // inner class AccessibleJWindow
  780. }
  781.  
  782.